/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

package 字符串.练习;

import org.junit.Test;

public class Test11 {
    public static void main(String[] args) {

    }
    @Test
    public void test(){
        String s1 = "abc";
        String s2 = "abc";// 共用一个对象 且不可变
        String s3 = new String("abc");// 新对象
        String s4 = new String("abc");// 新对象

        System.out.println(s1.equals(s2));// true
        System.out.println(s1 == s2);// true
        System.out.println(s3.equals(s4));// true
        System.out.println(s3 == s4);// false
        System.out.println(s1.equals(s3));// true
        System.out.println(s1 == s3);// false

    }
}
